<template>
  <div class="header">
    <!-- <img src="./static/images/logo.png" alt="Logo" /> -->
    <h3>商品溯源平台</h3>
    <span class="user-name" v-if="this.user"> {{ this.user }}</span>
  </div>
</template>

<script>
export default {
  name: "Header",
  props: ['login', 'user'],
}
</script>

<style scoped>
html,
body,
div,
p,
ul,
li,
img,
h3 {
  padding: 0;
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

body,
body>section {
  height: 100%;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* 确保标题和用户名称分布在两端 */
  background: linear-gradient(90deg, #4b6cb7 0%, #182848 100%);
  /* 渐变背景 */
  color: #fff;
  width: 100%;
  padding: 1rem 2rem;
  /* 增加内边距 */
  box-sizing: border-box;
  /* 确保宽度包含内边距 */
}

div.header h3 {
  margin: 0;
  /* 移除外边距 */
  color: #fff;
  font-size: 1.5rem;
  /* 增大字体大小 */
  font-weight: bold;
  /* 加粗 */
}

.header>.user-name {
  font-size: 1rem;
  /* 调整用户名称字体大小 */
  background-color: rgba(255, 255, 255, 0.2);
  /* 轻微背景色增加可读性 */
  padding: 0.5rem 1rem;
  /* 内边距 */
  border-radius: 15px;
  /* 圆角边框 */
  font-weight: normal;
  /* 字体加粗 */
}
</style>
